package com.zhengbing.tj.design.decorator;

/**
 * 装饰器模式Demo测试入口
 *
 * @author zhengbing
 * @date 2025-07-21
 */
public class DecoratorDemoMain {
    public static void main(String[] args) {
        System.out.println("--- 基础组件 ---");
        Component base = new ConcreteComponent();
        base.operation();

        System.out.println("\n--- 日志装饰器 ---");
        Component log = new LoggingDecorator(new ConcreteComponent());
        log.operation();

        System.out.println("\n--- 耗时+日志装饰器 ---");
        Component timeLog = new TimeDecorator(new LoggingDecorator(new ConcreteComponent()));
        timeLog.operation();

        System.out.println("\n--- 大写+耗时+日志装饰器 ---");
        Component all = new UppercaseDecorator(new TimeDecorator(new LoggingDecorator(new ConcreteComponent())));
        all.operation();
    }
} 